import 'package:cached_network_image/cached_network_image.dart';
/**
 * 会员中心
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:panda/base/Constant.dart';

class VipCenterPage extends StatefulWidget {
  int level;
  VipCenterPage({Key key, @required this.level}) : super(key: key);

  @override
  _VipCenterPageState createState() => _VipCenterPageState();
}

class _VipCenterPageState extends State<VipCenterPage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: Text('会员中心',
            style: TextStyle(
                fontSize: ScreenUtil.getInstance().setSp(BIG_FONT_SIZE),
                color: Colors.black)),
        backgroundColor: Colors.white,
        brightness: Brightness.light,
        centerTitle: true,
        iconTheme: new IconThemeData(color: Colors.black),
        elevation: 0.5,
        actions: <Widget>[
          GestureDetector(
            child: Container(
              alignment: Alignment.center,
              padding: EdgeInsets.fromLTRB(0, 0, 13, 0),
              child: Text(
                '等级说明',
                style: TextStyle(
                    fontSize: ScreenUtil.getInstance().setSp(NORMAL_FONT_SIZE),
                    color: Colors.black54),
              ),
            ),
            onTap: () {},
          )
        ],
      ),
      body: Container(
        color: white,
        width: double.infinity,
        padding: EdgeInsets.all(ScreenUtil.getInstance().setHeight(DP_30)),
        child: Column(
          children: <Widget>[
            Row(
              children: <Widget>[
                ClipOval(
                  child: CachedNetworkImage(
                imageUrl:
                    "https://upload.jianshu.io/users/upload_avatars/4348529/8b04d4ebc819?imageMogr2/auto-orient/strip|imageView2/1/w/96/h/96/format/webp",
                    width: ScreenUtil.getInstance().setWidth(DP_100),
                    height: ScreenUtil.getInstance().setWidth(DP_100),
                  ),
                ),
                Container(
                  width: 10,
                ),
                Text('1529****2263',
                    style: TextStyle(
                        color: black,
                        fontSize:
                            ScreenUtil.getInstance().setSp(NORMAL_FONT_SIZE)))
              ],
            ),
            Container(
              height: 10,
            ),
            Container(
              width: double.infinity,
              padding: EdgeInsets.fromLTRB(
                  ScreenUtil.getInstance().setHeight(DP_30),
                  ScreenUtil.getInstance().setHeight(DP_60),
                  ScreenUtil.getInstance().setHeight(DP_30),
                  ScreenUtil.getInstance().setHeight(DP_30)),
              height: ScreenUtil.getInstance().setHeight(DP_300),
              decoration: BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage(widget.level == 1
                          ? "images/card_user.png"
                          : "images/card_black.png"),
                      fit: BoxFit.cover)),
              child: Column(
                children: <Widget>[
                  Text('乐易用户',
                      style: TextStyle(
                          color: white,
                          fontSize: ScreenUtil.getInstance()
                              .setSp(BIG_FONT_SIZE * 2 - 20))),
                  Container(
                    height: ScreenUtil.getInstance().setHeight(DP_8),
                  ),
                  Text('有效期至2020-09-30',
                      style: TextStyle(
                          color: white,
                          fontSize:
                              ScreenUtil.getInstance().setSp(MINI_FONT_SIZE))),
                  Expanded(
                    child: Text(''),
                  ),
                  Row(
                    children: <Widget>[
                      Expanded(
                        child: Text('升级还需消费298元',
                            style: TextStyle(
                                color: white,
                                fontSize: ScreenUtil.getInstance()
                                    .setSp(MINI_FONT_SIZE))),
                      ),
                      Container(
                        padding: EdgeInsets.fromLTRB(
                            ScreenUtil.getInstance().setWidth(DP_15),
                            1,
                            ScreenUtil.getInstance().setWidth(DP_15),
                            1),
                        decoration: BoxDecoration(
                            border: Border.all(color: Colors.white, width: 1),
                            borderRadius: BorderRadius.circular(DP_10)),
                        child: Row(
                          children: <Widget>[
                            Text('查看成长值',
                                style: TextStyle(
                                    fontSize: ScreenUtil.getInstance()
                                        .setSp(NINIEST_FONT_SIZE),
                                    color: Colors.white)),
                          ],
                        ),
                      ),
                    ],
                  ),
                  Expanded(
                    child: Text(''),
                  ),
                  Row(
                    children: <Widget>[
                      Text('0',
                          style: TextStyle(
                              fontSize: ScreenUtil.getInstance()
                                  .setSp(SMALL_FONT_SIZE),
                              color: Colors.white)),
                      Container(
                        width: ScreenUtil.getInstance().setHeight(DP_15),
                      ),
                      Expanded(
                        child: Container(
                          child: LinearProgressIndicator(
                            value: 0.3,
                            backgroundColor: white,
                            valueColor:
                                new AlwaysStoppedAnimation<Color>(black_99),
                          ),
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(DP_100)),
                          height: ScreenUtil.getInstance().setHeight(DP_8),
                        ),
                      ),
                      Container(
                        width: ScreenUtil.getInstance().setHeight(DP_15),
                      ),
                      Text('19800',
                          style: TextStyle(
                              fontSize: ScreenUtil.getInstance()
                                  .setSp(SMALL_FONT_SIZE),
                              color: Colors.white)),
                    ],
                  )
                ],
              ),
            ),
            Container(
              padding:
                  EdgeInsets.all(ScreenUtil.getInstance().setHeight(DP_40)),
              child: Image.asset(
                "images/privilege_title.png",
                scale: 1.15,
              ),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(
                  0,
                  ScreenUtil.getInstance().setHeight(DP_20),
                  0,
                  ScreenUtil.getInstance().setHeight(DP_30)),
              child: Row(
                children: <Widget>[
                  Expanded(
                    child: Center(
                      child: Column(
                        children: <Widget>[
                          Image.asset(
                            "images/privilege_a_nomal.png",
                            scale: 1.2,
                          ),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_10),
                          ),
                          Text('自购7.8折',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(BIG_FONT_SIZE),
                                  color: Colors.black87)),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_8),
                          ),
                          Text('最高折扣2000元',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(SMALL_FONT_SIZE),
                                  color: Colors.black54)),
                        ],
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: Column(
                        children: <Widget>[
                          Image.asset(
                            "images/privilege_b_nomal.png",
                            scale: 1.2,
                          ),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_10),
                          ),
                          Text('分享奖励',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(BIG_FONT_SIZE),
                                  color: Colors.black87)),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_8),
                          ),
                          Text('最高返现53%',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(SMALL_FONT_SIZE),
                                  color: Colors.black54)),
                        ],
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: Column(
                        children: <Widget>[
                          Image.asset(
                            "images/privilege_c_nomal.png",
                            scale: 1.2,
                          ),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_10),
                          ),
                          Text('教育奖金',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(BIG_FONT_SIZE),
                                  color: Colors.black87)),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_8),
                          ),
                          Text('svip专享',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(SMALL_FONT_SIZE),
                                  color: Colors.black54)),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(
                  0,
                  ScreenUtil.getInstance().setHeight(DP_20),
                  0,
                  ScreenUtil.getInstance().setHeight(DP_30)),
              child: Row(
                children: <Widget>[
                  Expanded(
                    child: Center(
                      child: Column(
                        children: <Widget>[
                          Image.asset(
                            "images/privilege_d_nomal.png",
                            scale: 1.2,
                          ),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_10),
                          ),
                          Text('会员积分',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(BIG_FONT_SIZE),
                                  color: Colors.black87)),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_8),
                          ),
                          Text('最高返现53%',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(SMALL_FONT_SIZE),
                                  color: Colors.black54)),
                        ],
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: Column(
                        children: <Widget>[
                          Image.asset(
                            "images/privilege_e_nomal.png",
                            scale: 1.2,
                          ),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_10),
                          ),
                          Text('市场补贴',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(BIG_FONT_SIZE),
                                  color: Colors.black87)),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_8),
                          ),
                          Text('最低补贴1000元',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(SMALL_FONT_SIZE),
                                  color: Colors.black54)),
                        ],
                      ),
                    ),
                  ),
                  Expanded(
                    child: Center(
                      child: Column(
                        children: <Widget>[
                          Image.asset(
                            "images/privilege_f_nomal.png",
                            scale: 1.2,
                          ),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_10),
                          ),
                          Text('拿货特权',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(BIG_FONT_SIZE),
                                  color: Colors.black87)),
                          Container(
                            height: ScreenUtil.getInstance().setHeight(DP_8),
                          ),
                          Text('最高拿货3万件',
                              style: TextStyle(
                                  fontSize: ScreenUtil.getInstance()
                                      .setSp(SMALL_FONT_SIZE),
                                  color: Colors.black54)),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
